﻿using MyApp.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyApp.DataModels;
using SqlSugar;
using MyApp.IRepository;
using FullCoreDBModels;
using Oracle.ManagedDataAccess.Client;
using Newtonsoft.Json;
using System.IO;
using System.Data;

namespace MyApp.Repository
{
    public class SqlRepository: ISqlRepository
    {
        SqlSugarScope Db;
        public SqlRepository(SqlSugarScope Db)
        {
            this.Db = Db;
        }
        /// <summary>
        /// 执行查询
        /// </summary>
        /// <param name="ConfigId"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public DataTable GetDataTable(int configId, string sql)
        {
            return Db.GetConnection(configId).Ado.GetDataTable(sql);
        }
        /// <summary>
        /// 增删改
        /// </summary>
        /// <param name="ConfigId"></param>
        /// <param name="sql"></param>
        /// <returns></returns>
        public int ExecuteCommand(int configId, string sql)
        {
            return Db.GetConnection(configId).Ado.ExecuteCommand(sql);
        }
 
    }
}

